package com.xgjweb.fsi.service;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.xgjweb.common.dao.ICommonDao;
import com.xgjweb.common.service.CommonServiceImpl;
import com.xgjweb.common.utils.Constant;
import com.xgjweb.common.utils.XgjWebLogger;
import com.xgjweb.fsi.domain.Tech;

/**
 * 
 * @author xgj
 * 
 */
@SuppressWarnings("unchecked")
public class TechServiceImpl extends CommonServiceImpl implements ITechService {
	private ICommonDao techDao;

	public void setTechDao(ICommonDao techDao) {
		this.techDao = techDao;
	}

	/**
	 * 添加
	 */
	public Boolean addTech(Tech tech) throws Exception {
		try {
			tech.setStatementName("insertTech");
			techDao.insert(tech);
			return true;
		} catch (Exception e) {
			XgjWebLogger.getInstance().error(e.getMessage(), e);
			throw e;
		}
	}

	/**
	 * 更新
	 */
	public Boolean updateTech(Tech tech) throws Exception {
		try {
			tech.setStatementName("updateTech");
			techDao.update(tech);
			return true;
		} catch (Exception e) {
			XgjWebLogger.getInstance().error(e.getMessage(), e);
			throw e;
		}
	}

	/**
	 * 查询
	 */
	public List<Tech> queryTech() throws Exception {
		try {
			Tech tech = new Tech();
			tech.setStatementName("queryTech");
			List<Tech> techList = techDao.selectByList(tech);
			return techList;
		} catch (Exception e) {
			XgjWebLogger.getInstance().error(e.getMessage(), e);
			throw e;
		}
	}

	/**
	 * 查找
	 */
	public Tech findTech(Tech tech) throws Exception {
		try {
			tech.setStatementName("findTech");
			tech = (Tech) techDao.selectByObject(tech);
			return tech;
		} catch (Exception e) {
			XgjWebLogger.getInstance().error(e.getMessage(), e);
			throw e;
		}
	}

	/**
	 * 删除
	 */
	public Boolean deleteTech(Tech tech) throws Exception {
		try {
			tech.setStatementName("deleteTech");
			techDao.delete(tech);
			return true;
		} catch (Exception e) {
			XgjWebLogger.getInstance().error(e.getMessage(), e);
			throw e;
		}
	}


}
